package net.bolue.web.util;

import javax.servlet.http.HttpServletRequest;

public class RequestUtil {

	public static String getParamValue(HttpServletRequest request,String paramName){
		String str = request.getParameter(paramName);
		return str;
	}
	
	public static String getCndParamValue(HttpServletRequest request,String paramName){
		String str = request.getParameter("cnd_"+paramName);
		return str;
	}
	
	public static String getColParamValue(HttpServletRequest request,String paramName){
		String str = request.getParameter("col_"+paramName);
		return str;
	}
	
	public static Object parseValue(Integer jtype,String reqValue){
		if(jtype==null){
			return reqValue;
		}
		Object parseValue = reqValue;
		if(jtype==1||jtype==2){
			if(reqValue!=null&&!"".equals(reqValue)){
				parseValue = Integer.parseInt(reqValue);
			}else{
				parseValue = null;
			}
		}else if(jtype==5){
			if(reqValue!=null&&!"".equals(reqValue)){
				parseValue = Double.parseDouble(reqValue);
			}else{
				parseValue = null;
			}
		}
		return parseValue;
	}
}
